/**
 * 
 */


function charger(bodyElmt){
	
	var xhttp=new XMLHttpRequest();
	xhttp.open("GET","http://localhost:8080/xml-provider/tp/agences.xml",false);
	xhttp.onreadystatechange = function() {
		xmlDoc=xhttp.responseXML;
		
		var root = xmlDoc.documentElement;
		var child = root.getElementsByTagName("agence");

		
		for(var i=0;i<child.length;i++){
			var agence = child[i];
			var lieu = agence.getElementsByTagName("lieu").item(0).firstChild.nodeValue;
			var telephone = agence.getElementsByTagName("telephone").item(0).firstChild.nodeValue;
			
			var div = document.createElement("div");
			div.innerHTML = "<h3>"+lieu+"</h3>"+" "+telephone;
			
			bodyElmt.appendChild(div);
		}
		
	};
	
	xhttp.send(null);

	
}